/*Cliente : Desde aca vamos a hacer todas las llamadas*/

#include "myFunctions.h"
#include "perceptron.h"

using namespace std;

int main(int argc,char *argv[]){
	Perceptron P1,P2;
	mdouble X_or_test, X_xor_test;
	vector<int> y_or_test,y_xor_test;

	
	genRandom("or.txt", "orRandom.txt", 5, 200);
	genRandom("xor.txt", "xorRandom.txt", 5, 200);
	genRandom("or.txt", "orRandomTest.txt", 5, 50);
	genRandom("xor.txt", "xorRandomTest.txt", 5, 50);	
		
	// calculo para el OR
	mdouble X_or;
	vector<int> y_or;
	readFile(X_or, y_or, "orRandom.txt", true);
	P1.training(X_or, y_or, false);

	//test para OR
	readFile(X_or_test,y_or_test,"orRandomTest.txt",true);
	P1.testWithFile(X_or_test,y_or_test);
	//P1.testWithConsole();	
	getchar();
	
	// calculo para el XOR
	mdouble X_xor;
	vector<int> y_xor;
	readFile(X_xor, y_xor, "xorRandom.txt", true);
	P2.training(X_xor, y_xor, true);

	//test para XOR
	readFile(X_xor_test,y_xor_test,"xorRandomTest.txt",true);
	P2.testWithFile(X_xor_test,y_xor_test);
	//P2.testWithConsole();
	getchar();
	
	return 1;
}
